'''
pygeom -- Python Geometric Engine
ge -- Geometric Entity

The GE is the most basic form in pygeom. All Worlds contain
GEs, and these GEs interact with the World in various ways.
The most common way, of course, involves interacting as a
geometry, but constraints, forces, etc. are also GEs.
Furthering that point, all protocols here are set up to act
on geometric bodies, but there remains some special ways to
set up GEs that behave, for example, just as constraints or
"Scripted GEs" that behave on collision, geometric update,
or per physics tick.

Obviously, because of all of this, the GE is the most
important part of pygeom, and more objects in the pygeom
library inherit from GE than object (although GE does
inherit from object).

This class represents the culmination of ALL of the protocl
of pygeom, in a convenient package. Please, do not disturb
unless you know what you are doing.
'''

from pygeom import cls
from pygeom import intersect
from pygeom import constraint

class GE(object):
    def __init__(self):
        self._cls=cls.NOTSET
        self._imode=intersect.DEFER_ALL
        self._ctable=[NotImplemented]*len(constraint.CON_NAME)
        self._cvalid=True
        self._world=None
        #Where else should this be put?
        self._ConSetup()
        self._IsctSetup()
    @property
    def Class(self):
        return self._cls
    @property
    def IsctModes(self):
        return self._imode
    @property
    def ConTable(self):
        return self._ctable
    @property
    def ConValid(self):
        return self._cvalid
    @property
    def World(self):
        return self._world
    #Things used in the setup functions
    def _ConDefine(self, con, ffunc, cfunc, syntax):
        self._ctable[con]=constraint.ConSyntax(ffunc, cfunc, syntax)
    def _ConSetInvalid(self, inval):
        self._cvalid=not inval
    def _IsctMode(self, mode):
        self._imode=mode
    #Things that can be hooked from the World
    def _WorldUpdate(self):
        pass
    def _WorldRegister(self):
        pass
    def _WorldUnregister(self):
        pass
    #Preferably ONLY called from a World >:( NOT YOU
    def _WorldSet(self, w):
        self._world=w
